home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-1.iso / utility / horst_2.zip / SCRPCHK.BAT < prev    next >
DOS Batch File  |  1995-12-18  |  1KB  |  49 lines

  1. @echo off
  2. :: --- Checks that a file encoded with Horst Schaeffer's CSCRIPT is intact,
  3. :: --- by checking its CRC value.
  4. :: --- Uses Horst's CRC32.COM and NSET.COM. Also, of course, needs DEBUG.
  5. :: --- Assumes a properly clean script file!
  6. :: --- My own version has CRC32 and NSET in a PACO archive  <grin>
  7. if exist %1 goto GO
  8. ::
  9. echo 
  10. echo Can't find file %1!
  11. goto END
  12. ::
  13. :GO
  14. :: --- get the filename from line #1,
  15. :: --- pipe it into an environmental variable using NSET
  16. :: --- preface "n" (lower case) is removed by declaring it a separator (/Sn)
  17. type %1 | nset /L1/Sn FILENAME=$1
  18. ::
  19. :: --- extract the CRC value put into the original script by CSCRIPT
  20. find "CSCRIPT 2.2 by Horst Schaeffer" < %1 | nset ORIGINAL_CRC=$3
  21. :: --- re-create the file
  22. debug < %1
  23. ::
  24. :: --- now extract the CRC value of the decoded file into an environmental
  25. :: --- variable using CRC32 and NSET
  26. crc32 %FILENAME% | nset DECODED_CRC=$1
  27. ::
  28. :: --- and match them
  29. if [%ORIGINAL_CRC%]==[%DECODED_CRC%] goto OK
  30. echo 
  31. echo.
  32. echo   CRCs do not match!
  33. echo   Original=%ORIGINAL_CRC%, decoded=%DECODED_CRC%
  34. echo   Please check for file corruption!
  35. echo.
  36. goto END
  37. ::
  38. :OK
  39. echo.
  40. echo CRCs match (%ORIGINAL_CRC%), file %FILENAME% is OK
  41. echo.
  42. ::
  43. ::
  44. :END
  45. :: --- be kind to your environment, tidy up;
  46. set FILENAME=
  47. set ORIGINAL_CRC=
  48. set DECODED_CRC=
  49.